<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>交换2个变量案例</title>
</head>

<body>
  <script>
    // 1. 定义变量并赋值
    let apple = '苹果汁'
    let orange = '橙子汁'

    console.log(apple, orange)

    // 2. 定义一个临时变量, 把apple中的苹果汁倒入 (赋值)
    let temp = apple

    // 3. 把orange中的橙子汁倒入apple中 (赋值)
    apple = orange

    // 4. 把temp中的苹果汁倒入orange中 (赋值)
    orange = temp

    console.log(apple, orange)

  </script>
</body>

</html>